{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>编辑回收故障小项</h5>
                </div>
                <div class="ibox-content layui-form">
                    <div class="layui-row layui-col-space10 layui-form-item ">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">名称：</label>
                            <div class="layui-input-block">
                                <input type="text" name="ri_name" lay-verify="required" placeholder="名称" class="layui-input" value="{$info.ri_name}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">品牌：</label>
                            <div class="layui-input-block">
                                <select name="ri_brand_id" lay-search="" id="brand_id"  lay-filter="brand_id">
                                    <option value="">---- 请选择品牌 ----</option>
                                    {foreach name="brand" item="vo"}
                                    <option value="{$vo.brand_id}" {$vo.brand_id == $info.ri_brand_id ? 'selected' : ''}>{$vo.brand_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">型号：</label>
                            <div class="layui-input-block">
                                <select name="ri_models_id" lay-search=""  id="models_id"  lay-filter="models_id">
                                    <option value="">---- 请选择型号 ----</option>
                                    {foreach name='models' item='vo1'}
                                    <option value="{$vo1.models_id}" {$vo1.models_id == $info.ri_models_id ? 'selected' : ''}>{$vo1.models_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">回收故障：</label>
                            <div class="layui-input-block">
                                <select name="ri_recycle_id" lay-search=""  id="recycle_id"  lay-filter="recycle_id">
                                    <option value="">---- 请选择回收故障 ----</option>
                                    {foreach name='recycle' item='vo2'}
                                    <option value="{$vo2.recycle_id}" {$vo2.recycle_id == $info.ri_recycle_id ? 'selected' : ''}>{$vo2.recycle_name}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">抵扣价：</label>
                            <div class="layui-input-block">
                                <input type="text" name="ri_price" lay-verify="required" placeholder="抵扣价" class="layui-input" oninput="value=value.replace(/^[^\d.]/g,'')" value="{$info.ri_price}">
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8 form-group">
                            <label class="layui-form-label">是否环保回收：</label>
                            <div class="layui-input-block">
                                <input type="radio" name="ri_is_hb" value="1" title="是" {$info.ri_is_hb == 1 ? 'checked' : ''}>
                                <input type="radio" name="ri_is_hb" value="2" title="否" {$info.ri_is_hb == 2 ? 'checked' : ''}>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <label class="layui-form-label">文字说明：</label>
                            <div class="layui-input-block">
                                <textarea name="ri_word" lay-verify="required" placeholder="文字说明" class="layui-textarea">{$info.ri_word}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md10">
                            <label class="layui-form-label">图片说明</label>
                            <div class="layui-input-block">
                                <input type="hidden" name="del" id="del2" value="">
                                <input type="hidden" id="hid2" value="{$info.ri_images}">
                                <input type="hidden" name="photo" id="photo2" value="{$info.ri_images}">
                                <div id="uploader2" class="container-s">
                                    <div class="queueList">
                                        <div class="placeholder">
                                            <div id="filePicker2"></div>
                                            <p>或将照片拖到这里</p>
                                        </div>
                                    </div>
                                    <div class="statusBar" style="display:none;">
                                        <div class="layui-progress layui-progress-big active-s" lay-showpercent="true">
                                            <div class="layui-progress-bar layui-bg-blue" lay-percent="0%">
                                            </div>
                                            <span></span>
                                        </div>
                                        <div class="info"></div>
                                        <div class="btns">
                                            <div id="goPicker2" class="filePicker2"></div>
                                            <div class="uploadBtn">开始上传</div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <input type="hidden" value="{$ri_id}" name="ri_id">

                        <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
                                </button>
                                <button class="layui-btn layui-btn-primary" onclick="history.go(-1)">关闭</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}

<script>
    var n2 = wk.uploads({num:9,type:'png,jpg,jpeg',attr:2,status:'update',url:"{:url('admin/upload/upload')}"});
    function imgDel2(e,obj,hid,del){
        wk.update_del(e,obj,hid,del,n2);
    }
    layui.use(['form','upload','layedit'], function() {
        var form = layui.form;
        form.on('submit(component-form-element)', function (data) {
            $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
            $.ajax({
                url:"{:url('infoEdit')}",
                type:'post',
                dataType:'json',
                data:data.field,
                success:function(res){
                    if (res.code == 200) {
                        wk.success(res.msg,"{:url('Recycleinfo/index')}")
                    } else {
                        wk.error(res.msg,'','$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\');');
                    }
                }
            })
        });
    });
</script>

</body>
</html>
